let path = require('path')
let nodeExternals = require('webpack-node-externals')
let { VueLoaderPlugin } = require('vue-loader/dist/index')
module.exports = {
	target: 'node',
	mode: 'development',
	entry: './src/server/index.js',
	output: {
		filename: 'server_bundle.js',
		path: path.resolve(__dirname, '../build/server'),
	},
	module: {
		rules: [
			{
				test: /\.js$/,
				use: [
					{
						loader: 'babel-loader',
					},
				],
			},
			{
				test: /\.vue$/,
				loader: 'vue-loader',
			},
		],
	},
	plugins: [new VueLoaderPlugin()],
	resolve: {
		// 配置这个，以后导包遇到如下的文件，不需要编写扩展名了。
		extensions: ['.js', '.json', '.wasm', '.jsx', '.jsx', 'vue'],
	},
	externals: [nodeExternals()],
}
